/*
 * Recruitment.java
 *
 * This program demonstrates the use of while loop to recruite
 * three candidates for the post of Project Manager.
 *
 
 */

package com.javacore.day3.recruitmentprocess;

import java.util.Scanner;

/**
 *
 * @author
 */

public class Recruitment {
    
    /**
     * Creates a new instance of Recruitment
     */
    public Recruitment() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int choice;
        int experience = 0;
        int count = 1;
        Scanner input = new Scanner(System.in);
        
        /* Iterate until three Project Managers having MBA degree with 5 years
           of experience are selected */
        while(count < 4) {
            System.out.println("\nEnter the years of Experience: ");
            experience = input.nextInt();
            
            /* Check whether the experience of candidate is greater than
               5 years */
            if(experience > 5) {
                System.out.println("\nAre you an MBA? (1 = Yes, 2 = No): ");
                choice = input.nextInt();
                
                /* If the candidate has more than 5 years of experience then
                   check if the candidate possesses an MBA degree */
                if(choice == 1)
                    count++;
                else
                    System.out.println("Sorry, you need to be an MBA as well.");
            } else {
                System.out.println("Sorry, you need to have more than 5 years" +
                        " of experience.");
            }
            System.out.print("********************************************");
        }
        
        // Display the message after the recruitment process is completed.
        System.out.println("\nThe recruitment process is completed.");
        System.out.println("Three Project Managers have been selected.\n");
    }
}